import Clipboard from "clipboard";

export default function handleClipboard(copyText: string) {
    const btn = document.createElement("button");
    const clipboard = new Clipboard(btn, { text: () => copyText });
    clipboard.on('success', () => { clipboard.destroy(); });
    clipboard.on('error', () => { clipboard.destroy(); });
    btn.click();
    (<any>btn) = undefined;
}